<?php
/**
 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
 * all the essential functionalities required for any enterprise.
 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
 *
 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA
 */

//$workshifts = $records[0];
$list = $records['list'];
$year = $records['year'];
$hasDefRecord = $records['hasDefRecord'];
$rights = $records['rights'];
//print_r($records);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
require_once ROOT_PATH . '/lib/confs/sysConf.php';
require_once ROOT_PATH . '/lib/controllers/ArgClassController.php';
require_once ROOT_PATH . '/lib/models/eimadmin/CompStruct.php';

	$sysConst = new sysConf();
	$locRights = $_SESSION['localRights'];

	//$headingInfo =$this->popArr['headinginfo'];

    //$currentPage = $this->popArr['currentPage'];
	//$emplist = $this->popArr['emplist'];

	/*if (!isset($this->getArr['sortField']) || ($this->getArr['sortField'] == '')) {
		$this->getArr['sortField']=4;
		$this->getArr['sortOrder4']='ASC';
	}*/

	function getNextSortOrder($curSortOrder) {
		switch ($curSortOrder) {
			case 'null' :
				return 'ASC';
				break;
			case 'ASC' :
				return 'DESC';
				break;
			case 'DESC'	:
				return 'ASC';
				break;
		}

	}

	$GLOBALS['lang_Common_SortAscending'] = $lang_Common_SortAscending;
	$GLOBALS['lang_Common_SortDescending'] = $lang_Common_SortDescending;

	function nextSortOrderInWords($sortOrder) {
		return $sortOrder == 'ASC' ? $GLOBALS['lang_Common_SortDescending'] : $GLOBALS['lang_Common_SortAscending'];
	}
	
?>
<head>
<link href="../../themes/<?php echo $styleSheet; ?>/css/style.css" rel="stylesheet" type="text/css"/>
<!--[if lte IE 6]>
<link href="../../themes/<?php echo $styleSheet; ?>/css/IE6_style.css" rel="stylesheet" type="text/css"/>
<![endif]-->
<!--[if IE]>
<link href="../../themes/<?php echo $styleSheet; ?>/css/IE_style.css" rel="stylesheet" type="text/css"/>
<![endif]-->
<script type="text/javascript" src="../../themes/<?php echo $styleSheet;?>/scripts/style.js"></script>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="../../scripts/octopus.js"></script>
<script type="text/javascript" src="../../scripts/ajax.js"></script>
<script type="text/javascript">
//<![CDATA[
	function nextPage() {
		i=document.standardView.pageNO.value;
		i++;
		document.standardView.pageNO.value=i;
		document.standardView.submit();
	}

	function prevPage() {
		var i=document.standardView.pageNO.value;
		i--;
		document.standardView.pageNO.value=i;
		document.standardView.submit();
	}

	function chgPage(pNO) {
		document.standardView.pageNO.value=pNO;
		document.standardView.submit();
	}

	function sortAndSearch(sortField, sortOrder) {
		var uri = "<?php echo $_SERVER['PHP_SELF']?>?reqcode=<?php //echo $this->getArr['reqcode']?>&VIEW=MAIN&sortField=" + sortField + "&sortOrder" + sortField + "=" + sortOrder;
		document.standardView.action = uri;
		document.standardView.submit();
	}
	
	function argClass(rgtz, txt, parnt) {
		currentEditNodeValues = ['', '', '', '', ''];
		document.frmAddNode.reset();
		//document.getElementById("cmbLocation").selectedIndex = 0;
		document.getElementById("cmbType").selectedIndex = 0;
		document.frmAddNode.rgt.value=rgtz;
		document.frmAddNode.sqlState.value='NewRecord';
		document.getElementById("parnt").innerHTML="排班系统"+txt;
		document.getElementById("txtParnt").value=parnt;
		document.getElementById("layerForm").style.visibility="visible";
	}
	
	function frmAddHide () {
		//document.getElementById("txtType").style.visibility="hidden";
		document.getElementById("layerForm").style.visibility="hidden";
		//document.getElementById("layerFormLoc").style.visibility = "hidden";
		//document.getElementById("tblCompStruct").focus();
	}

	function frmEditHide () {
		//document.getElementById("txtType").style.visibility="hidden";
		document.getElementById("layerEditForm").style.visibility="hidden";
		//document.getElementById("layerFormLoc").style.visibility = "hidden";
	}
	
	function handle_request(val,year,month,workgroup,group,day){
			//val=document.getElementById("number_"+id).value;
			url="../../ajax_handle.php?action=argclass_year&year="+year+"&month="+month+"&wg="+workgroup+"&group="+group+"&day="+day+"&val="+val;
			//alert(url);
			//sendRequest(url,"m_"+id+"|allnumber|allmoney");
			sendRequest(url);
	}
	
	function changeGroupTable(groupType) {
		switch(groupType) {
			case 1:
				$('chejianban').style.display = 'block';
				$('baoanban').style.display = 'none';
				$('chufangban').style.display = 'none';
				$('xingzhengban').style.display = 'none';
				break;
			case 2:
				$('chejianban').style.display = 'none';
				$('baoanban').style.display = 'none';
				$('chufangban').style.display = 'none';
				$('xingzhengban').style.display = 'block';
				break;
			case 3:
				$('chejianban').style.display = 'none';
				$('baoanban').style.display = 'block';
				$('chufangban').style.display = 'none';
				$('xingzhengban').style.display = 'none';
				break;
			case 4:
				$('chejianban').style.display = 'none';
				$('baoanban').style.display = 'none';
				$('chufangban').style.display = 'block';
				$('xingzhengban').style.display = 'none';
				break;
		}
	}

<?php if(false) { ?>
	function returnAdd() {

		location.href = "./CentralController.php?reqcode=<?php //echo $this->getArr['reqcode']?>&capturemode=addmode";

	}

	function returnDelete() {
		$check = 0;
		with (document.standardView) {
			for (var i=0; i < elements.length; i++) {
				if ((elements[i].type == 'checkbox') && (elements[i].checked == true)){
					$check = 1;
				}
			}
		}

		if ( $check == 1 ){
			document.standardView.delState.value = 'DeleteMode';
			document.standardView.pageNO.value=1;
			document.standardView.submit();
		}else{
			alert("<?php echo $lang_Error_SelectAtLeastOneRecordToDelete; ?>");
		}
	}

<?php } else { ?>
	function returnAdd() {
        var popup=window.open('../../templates/hrfunct/emppop.php?reqcode=<?php //echo $this->getArr['reqcode']?>','Employees','height=450,width=400,scrollbars=1');
        if(!popup.opener) popup.opener=self;
	}
<?php } ?>

	function returnSearch() {
		document.standardView.captureState.value = 'SearchMode';
		//document.standardView.pageNO.value=1;
		document.standardView.submit();
	}

	function doHandleAll()
	{
		with (document.standardView) {
			if(elements['allCheck'].checked == false){
				doUnCheckAll();
			}
			else if(elements['allCheck'].checked == true){
				doCheckAll();
			}
		}
	}

	function doCheckAll() {
		with (document.standardView) {
			for (var i=0; i < elements.length; i++) {
				if (elements[i].type == 'checkbox') {
					elements[i].checked = true;
				}
			}
		}
	}

	function doUnCheckAll()
	{
		with (document.standardView) {
			for (var i=0; i < elements.length; i++) {
				if (elements[i].type == 'checkbox') {
					elements[i].checked = false;
				}
			}
		}
	}
	
	/**
	 * If at least one day is unchecked, main check box would be unchecked
	 */

	function unCheckMain() {
		noOfCheckboxes = 0;
		noOfCheckedCheckboxes = 0;

		with (document.getElementById('standardView')) {
			for (i = 0; i < elements.length; i++) {
				if (elements[i].type == 'checkbox' && elements[i].name != 'allCheck') {
					noOfCheckboxes++;
					if (elements[i].checked == true) {
						noOfCheckedCheckboxes++;
					}

				}
			}
		}

		document.getElementById('allCheck').checked = (noOfCheckboxes == noOfCheckedCheckboxes);
	}

	function clear_form() {
		document.standardView.loc_code.options[0].selected=true;
		document.standardView.loc_name.value='';
	}
	
	function actionShowAdd() {
		$('addPanel').style.display = 'block';
		$('argClassBatch').reset();
	}
	
	function hadArgRecord() {
		var year = $('year').value;
		var month = $('month').value;
		var url="../../ajax_handle.php?action=checkArgRecord&year="+year+"&month="+month;
		//sendRequest(url,"m_"+id+"|allnumber|allmoney");
		<?php
			//$result = file_get_contents(url);
			//if($result) echo "var result=".$result.";";
		?>
		var result = sendRequest(url,'batcharg');
		return false;
		//$('argClassBatch').submit();
	}

	parent.scrollTo(0, 0);
//]]>
</script>
</head>
<body>
<div id="addPanel" class="outerbox" style="width:500px;display:none;">
<div class="mainHeading"><h2>批量排班</h2></div>
	<form action="?argcode=argclass&action=Arg_Class_Batch" method="post" id="argClassBatch" name="argClassBatch">
<table width="500" border="0" cellpadding="4" cellspacing="0">
    <tr>
      <td>&nbsp;选择年月份：</td>
      <td align="left"><select name="year" id="year">
				<?php
					 $thisyear = @date("Y",time());
					 for ($c=2010; 2051>$c; $c++) {
					 	if ($thisyear==$c) {
						   echo "<option selected value='$c'>".$c ."年</option>";
						} else {
						   echo "<option value='$c'>".$c ."年</option>";
						}
					 }
				?>
			</select>
      		<select name="month" id="month" onchange="hadArgRecord();">
      	  	  <?php
					 $thismonth = @date("m",time());
					 $nextmonth = ($thismonth==12) ? '12' : ($thismonth+1);
					 for ($c=1; 13>$c; $c++) {
					 	if ($nextmonth==$c) {
						   echo "<option selected value='$c'>".$c ."月</option>";
						} else {
						   echo "<option value='$c'>".$c ."月</option>";
						}
					 }
				?>
      	  </select><?php if($hasDefRecord) echo "<font color=red>".$nextmonth."月已有排班记录,重新排班将覆盖原先的记录.</font>";?></td>
    </tr>
    
    <tr>
      <td>&nbsp;选择排班对象：</td>
      <td><input type="radio" name="workgroup" value="1" onclick="changeGroupTable(1);" checked />车间班
	      <input type="radio" name="workgroup" value="3" onclick="changeGroupTable(3);" />保安班
	      <input type="radio" name="workgroup" value="4" onclick="changeGroupTable(4);" />厨房班
	      <input type="radio" name="workgroup" value="2" onclick="changeGroupTable(2);" />行政班
      </td>
    </tr>
    
    <tr>
      <td colspan="2">
    	<table id="chejianban" style="display:block; disabled:true;">
    	<tr>
      		<td colspan="2"><font color="green">注：班次链是指每一个班上班的一个有规律的编排轮换次序，譬如AAAW->BBBW->CCCW班次链，就表示从A班到B班再到C班这样
      一个循环轮班的次序，因此，CCCW->AAAW->BBBW以及BBBW->CCCW->AAAW班次链，跟AAAW->BBBW->CCCW班次链是等同的，这一类属于顺序班次链。<br/>
      同样道理，CCCW->BBBW->AAAW班次链与BBBW->AAAW->CCCW、CCCW->AAAW->BBBW班次链等同，这一类属于倒序班次链。<br/>
      我们将AAAW->BBBW->CCCW班次链 简写为ABC班次链，同理，CCCW->BBBW->AAAW简写为CBA班次链。</font>
      		</td>
    	</tr>
    
    	<tr>
      		<td>&nbsp;选择班次链：</td>
      		<td><select name="classlink1" id="classlink1">
      		<option value="ABC">ABC(BCA/CAB)</option>
      		<option value="CBA">CBA(BAC/ACB)</option>
          </select>
      		</td>
    	</tr>
    
    	<tr>
      		<td><b>车间1班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum11" id="startnum11">
      		<option value="3">3个</option>
      		<option value="2">2个</option>
      		<option value="1">1个</option>
        	</select>
         	<select name="startclass11" id="startclass11">
      		<option value="A">A</option>
      		<option value="B">B</option>
      		<option value="C">C</option>
      		<option value="WA">W->A</option>
      		<option value="WB">W->B</option>
      		<option value="WC">W->C</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>车间2班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum12" id="startnum12">
      		<option value="2">2个</option>
      		<option value="1">1个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass12" id="startclass12">
      		<option value="C">C</option>
      		<option value="A">A</option>
      		<option value="B">B</option>
      		<option value="WA">W->A</option>
      		<option value="WB">W->B</option>
      		<option value="WC">W->C</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>车间3班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum13" id="startnum13">
      		<option value="1">1个</option>
      		<option value="2">2个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass13" id="startclass13">
      		<option value="B">B</option>
      		<option value="C">C</option>
      		<option value="A">A</option>
      		<option value="WA">W->A</option>
      		<option value="WB">W->B</option>
      		<option value="WC">W->C</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>车间4班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left" colspan="3"><select name="startnum14" id="startnum14">
      		<option value="1">1个</option>
      		<option value="2">2个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass14" id="startclas1s4">
      		<option value="WB">W->B</option>
      		<option value="WA">W->A</option>
      		<option value="WC">W->C</option>
      		<option value="A">A</option>
      		<option value="B">B</option>
      		<option value="C">C</option>
         	</select>
      		</td>
    	</tr>
    	</table>
    	
    	<table id="baoanban" style="display:none;">
    	<tr>
      		<td colspan="2"><font color="green">注：班次链是指每一个班上班的一个有规律的编排轮换次序，譬如IIIW->JJJW->KKKW班次链，就表示从I班到J班再到K班这样
      一个循环轮班的次序，因此，KKKW->IIIW->JJJW以及JJJW->KKKW->IIIW班次链，跟IIIW->JJJW-KKKW班次链是等同的，这一类属于顺序班次链。<br/>
      同样道理，KKKW->JJJW->IIIW班次链与JJJW->IIIW->KKKW、KKKW->IIIW->JJJW班次链等同，这一类属于倒序班次链。<br/>
      我们将IIIW->JJJW->KKKW班次链 简写为IJK班次链，同理，KKKW->JJJW->IIIW简写为KJI班次链。</font>
      		</td>
    	</tr>
    
    	<tr>
      		<td>&nbsp;选择班次链：</td>
      		<td><select name="classlink3" id="classlink3">
      		<option value="IJK">IJK(JKI/KIJ)</option>
      		<option value="KJI">KJI(JIK/IKJ)</option>
          </select>
      		</td>
    	</tr>
    
    	<tr>
      		<td><b>保安1班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum31" id="startnum31">
      		<option value="3">3个</option>
      		<option value="2">2个</option>
      		<option value="1">1个</option>
        	</select>
         	<select name="startclass31" id="startclass31">
      		<option value="I">I</option>
      		<option value="J">J</option>
      		<option value="K">K</option>
      		<option value="WI">W->I</option>
      		<option value="WJ">W->J</option>
      		<option value="WK">W->K</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>保安2班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum32" id="startnum32">
      		<option value="2">2个</option>
      		<option value="1">1个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass32" id="startclass32">
      		<option value="K">K</option>
      		<option value="I">I</option>
      		<option value="J">J</option>
      		<option value="WI">W->I</option>
      		<option value="WJ">W->J</option>
      		<option value="WK">W->K</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>保安3班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum33" id="startnum33">
      		<option value="1">1个</option>
      		<option value="2">2个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass33" id="startclass33">
      		<option value="J">J</option>
      		<option value="K">K</option>
      		<option value="I">I</option>
      		<option value="WI">W->I</option>
      		<option value="WJ">W->J</option>
      		<option value="WK">W->K</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>保安4班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left" colspan="3"><select name="startnum34" id="startnum34">
      		<option value="1">1个</option>
      		<option value="2">2个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass34" id="startclass34">
      		<option value="WJ">W->J</option>
      		<option value="WI">W->I</option>
      		<option value="WK">W->K</option>
      		<option value="I">I</option>
      		<option value="J">J</option>
      		<option value="K">K</option>
         	</select>
      		</td>
    	</tr>
    	</table>
    	
    	<table id="chufangban" style="display:none;">
    	<tr>
      		<td colspan="2"><font color="green">注：班次链是指每一个班上班的一个有规律的编排轮换次序，譬如OOOW->PPPW->QQQW班次链，就表示从O班到P班再到Q班这样
      一个循环轮班的次序，因此，QQQW->OOOW->PPPW以及PPPW->QQQW->OOOW班次链，跟OOOW->PPPW->QQQW班次链是等同的，这一类属于顺序班次链。<br/>
      同样道理，QQQW->PPPW->OOOW班次链与PPPW->OOOW->QQQW、QQQW->OOOW->PPPW班次链等同，这一类属于倒序班次链。<br/>
      我们将OOOW->PPPW->QQQW班次链 简写为OPQ班次链，同理，QQQW->PPPW->OOOW简写为QPO班次链。</font>
      		</td>
    	</tr>
    
    	<tr>
      		<td>&nbsp;选择班次链：</td>
      		<td><select name="classlink4" id="classlink4">
      		<option value="OPQ">OPQ(PQO/QOP)</option>
      		<option value="QPO">QPO(POQ/OQP)</option>
          </select>
      		</td>
    	</tr>
    
    	<tr>
      		<td><b>车间1班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum41" id="startnum41">
      		<option value="3">3个</option>
      		<option value="2">2个</option>
      		<option value="1">1个</option>
        	</select>
         	<select name="startclass41" id="startclass41">
      		<option value="O">O</option>
      		<option value="P">P</option>
      		<option value="Q">Q</option>
      		<option value="WO">W->O</option>
      		<option value="WP">W->P</option>
      		<option value="WQ">W->Q</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>车间2班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum42" id="startnum42">
      		<option value="2">2个</option>
      		<option value="1">1个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass42" id="startclass42">
      		<option value="Q">Q</option>
      		<option value="O">O</option>
      		<option value="P">P</option>
      		<option value="WO">W->O</option>
      		<option value="WP">W->P</option>
      		<option value="WQ">W->Q</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>车间3班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left"><select name="startnum43" id="startnum43">
      		<option value="1">1个</option>
      		<option value="2">2个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass43" id="startclass43">
      		<option value="P">P</option>
      		<option value="Q">Q</option>
      		<option value="O">O</option>
      		<option value="WO">W->O</option>
      		<option value="WP">W->P</option>
      		<option value="WQ">W->Q</option>
         	</select>
      		</td>
    	</tr>
    	<tr>
      		<td><b>车间4班</b>&nbsp;&nbsp;&nbsp;起始班次：</td>
      		<td align="left" colspan="3"><select name="startnum44" id="startnum44">
      		<option value="1">1个</option>
      		<option value="2">2个</option>
      		<option value="3">3个</option>
        	</select>
         	<select name="startclass44" id="startclass44">
      		<option value="WP">W->P</option>
      		<option value="WO">W->O</option>
      		<option value="WQ">W->Q</option>
      		<option value="O">O</option>
      		<option value="P">P</option>
      		<option value="Q">Q</option>
         	</select>
      		</td>
    	</tr>
    	</table>
    	
      </td>
    </tr>
  </table>
  
  <table id="xingzhengban" style="display:none;">
    	<tr>
      		<td colspan="2"><font color="green">注：分行政日班(D班)和行政夜班(N班)，周末不排班，周末班次为W班。</font>
      		</td>
    	</tr>
    	<tr>
      		<td><b>行政日班：</b></td>
      		<td align="left">D</td>
    	</tr>
    	<tr>
      		<td><b>行政夜班：</b></td>
      		<td align="left">N</td>
    	</tr>
    	<tr>
      		<td><b>周末双休：</b></td>
      		<td align="left">W</td>
    	</tr>
    </table>

    <div class="formbuttons">
        <input type="submit" class="savebutton" id="saveBtn"
            onmouseover="moverButton(this);" onmouseout="moutButton(this);"
            value="<?php echo $lang_Common_Save;?>" />
    </div>
</form>
</div>


<div class="outerbox">
	<form name="standardView" id="standardView" method="post" action="<?php echo $_SERVER['PHP_SELF']?>?argcode=argclass&amp;action=View_Class_Arg&amp;">

		<div class="mainHeading"><h2>工作排班</h2></div>
		<input type="hidden" name="captureState" value="<?php //echo isset($this->postArr['captureState'])?$this->postArr['captureState']:''?>" />
		<input type="hidden" name="delState" value="" />
		<input type="hidden" name="pageNO" value="<?php //echo isset($this->postArr['pageNO'])?$this->postArr['pageNO']:'1'?>" />
		<input type="hidden" name="empID" value="" />


		<?php
		if (isset($this->getArr['message'])) {
			$expString  = $this->getArr['message'];
			$messageType = CommonFunctions::getCssClassForMessage($expString);
			$messageType = 'failure';
		?>
		<div class="messagebar">
			<span class="<?php echo $messageType; ?>"><?php echo $$expString; ?></span>
		</div>
		<?php
		}
		?>

		<div class="searchbox">
			<label for="year">选择年份：</label>
			<select name="year" id="year">
				<?php
					 //$optionCount = count($srchlist[0]);
					 if (!isset($year)) $year = @date("Y",time());
					 for ($c=2010; 2051>$c; $c++) {
					 	if ($year==$c) {
						   echo "<option selected value='$c'>".$c ."</option>";
						} else {
						   echo "<option value='$c'>".$c ."</option>";
						}
					 }
				?>
			</select>
			<!--label for="loc_name"><?php //echo $description?></label>
			<input type="text" size="20" name="loc_name" id="loc_name" value="<?php //echo isset($this->postArr['loc_name'])? stripslashes($this->postArr['loc_name']):''?>" /-->
			<input type="button" class="plainbtn" onclick="returnSearch();"
				onmouseover="this.className='plainbtn plainbtnhov'" onmouseout="this.className='plainbtn'"
				value="<?php echo $lang_Common_Search;?>" />
			<input type="button" class="plainbtn" onclick="clear_form();"
				onmouseover="this.className='plainbtn plainbtnhov'" onmouseout="this.className='plainbtn'"
				 value="<?php echo $lang_Common_Reset;?>" />
			<br class="clear"/>
		</div>

			<div class="actionbar">
				<div class="actionbuttons">
					<?php $locRights['add']=true;?>
					<input type="button" class="plainbtn"
					<?php echo ($locRights['add']) ? 'onclick="actionShowAdd();"' : 'style=visibility:hidden;'; ?>
						onmouseover="this.className='plainbtn plainbtnhov'" onmouseout="this.className='plainbtn'"
						value="批量排班" />

					<?php //if($this->getArr['reqcode']=='EMP') { ?>
					<?php if(true) { ?>
						<input type="button" class="plainbtn"
						<?php echo ($locRights['delete']) ? 'onclick="returnDelete();"' : 'style=visibility:hidden;'; ?>
							onmouseover="this.className='plainbtn plainbtnhov'" onmouseout="this.className='plainbtn'"
							value="<?php echo $lang_Common_Delete;?>" />

					<?php } ?>
				</div>
				<div class="noresultsbar"><?php //echo (empty($emplist)) ? $norecorddisplay : '';?></div>
				<div class="pagingbar">
				<?php
					//$temp = $this->popArr['temp'];
					$temp = '';
					$currentPage = 1;
					$commonFunc = new CommonFunctions();
					$pageStr = $commonFunc->printPageLinks($temp, $currentPage);
					$pageStr = preg_replace(array('/#first/', '/#previous/', '/#next/', '/#last/'), array($lang_empview_first, $lang_empview_previous, $lang_empview_next, $lang_empview_last), $pageStr);

					echo $pageStr;

					for ($j = 0; $j < 11; $j++) {
						if (!isset($this->getArr['sortOrder'.$j])) {
							$this->getArr['sortOrder'.$j] = 'null';
						}
					}
				?>
				</div>
			<br class="clear" />
			</div>
			<br class="clear" />
				<table cellspacing="0" cellpadding="0" class="data-table">
					<thead>
					<tr>
						<td scope="col" align="center" width="30px;">月份</td>
						<td scope="col" width="50px;">班次</td>
						<?php
							for ($i=1;$i<32;$i++) {
								echo "<td scope='col' style='text-align:center;'>".$i."</td>";
							}
						?>
					</tr>
					</thead>

					<tbody>
					<?php
						$r=0;
						$mg=0;
						for ($m=1;$m<13;$m++) {
							$mon_start=1;
							echo "<tr><td rowspan=14 align=center valign='middle'><font size=4>".$m."月</font></td>";
							//$month_record = $list[$j];
							for($w=1;$w<5;$w++) {
								//if($w==2) continue;
								$mg++;
								switch($w) {
									case 1:
										$workObj = "车间";
										break;
									case 3:
										$workObj = "保安";
										break;
									case 4:
										$workObj = "厨房";
										break;
									default:
										$workObj = "行政";
								}
								for($g=1;$g<5;$g++) {
									//$rstyle = $k%2==0 ? " style='background-color: #CCFF66;'" : "";
									if($w==2 && $g>2) continue; 
									$rstyle = $mg%2==0 ? " class='row1'" : "";
									$inptyle = $mg%2==0 ? " style='text-align:center;background-color:#ffb;'" : " style='text-align:center;'";
									if($mon_start==1) echo "<td>车间".$g."班</td>";
									else echo "<tr ".$rstyle."><td>".$workObj.$g."班</td>";

									if(in_array($m,array(1,3,5,7,8,10,12))) $max_day = 31;
									elseif(in_array($m,array(4,6,9,11))) $max_day = 30;
									elseif( $year%4==0 && ($year%100!=0 || $year%400==0) ) $max_day = 29; //闰年二月份29天
									else $max_day = 28;
									$maxd = $max_day+1;
									$mon_start++;
									for ($d=1;$d<$maxd;$d++) {
										//echo "<td scope='col' align='center'><a href='#layerForm' class='add' onclick=\"argClass('', '', '', '')\">排班</a></td>";
										echo "<td scope='col' style='text-align:center;'><input name='c_class'".$m.$w.$g.$d." id='c_class'".$m.$w.$g.$d." value='".$list[$m][$w][$g][$d]."' size=1 ".$inptyle." onblur='handle_request(this.value,$year,$m,$w,$g,$d)' /></td>";
									}
									echo "</tr>";
								}
							}
						}
					?>

					</tbody>
				</table>
	</form>
</div>

<!-- Add Subdivision  -->
	<div id="layerForm"  class="frame" style="visibility:hidden;margin-right:10px;width:420px;">
        <div class="outerbox">
        <div class="subHeading"><h3 id="parnt">&nbsp;</h3></div>
		<form name="frmAddNode" id="frmAddNode" method="post" action="<?php echo $_SERVER['PHP_SELF']?>?uniqcode=<?php //echo $this->getArr['uniqcode']?>&amp;id=1" onsubmit="validate(); return false;">

		<input type="hidden" value="" id="add_rgt" name="rgt"/>
		<input type="hidden" value=""  name="sqlState"/>
		<input type="hidden" value="" id="txtParnt" name="txtParnt"/>

        <label id="lblType" for="cmbType">班制选择<span class="required">*</span></label>
		<select name="cmbType" id="cmbType" class="formSelect">
            <option value="null"><?php echo $lang_Leave_Common_Select; ?></option>
			<?php foreach ($workshifts as $workshift) { 
				$value = $workshift->getName();
				$option = $workshift->getName()."-".$workshift->getTypeName();
				echo "<option value='".$value."'>".$option."</option>";
			?>
				<?php //vprintf('<option value="%s">%s</option>', $typex);?>
			<?php } ?>
		</select>
        <br class="clear" />

        <div class="formbuttons">
            <input type="button" class="savebutton"
                onclick="validate();" onmouseover="moverButton(this);" onmouseout="moutButton(this);"
                value="<?php echo $lang_Common_Save;?>" />
            <input type="button" class="clearbutton" onclick="resetAddNodeForm();"
                onmouseover="moverButton(this);" onmouseout="moutButton(this);"
                 value="<?php echo $lang_Common_Reset;?>" />
			<input type="button" class="savebutton" onclick="frmAddHide();" value="<?php echo $lang_compstruct_hide;?>" />
		</div>
	</form>
    <br class="clear" />
    </div>
    <div class="requirednotice"><?php echo preg_replace('/#star/', '<span class="error">*</span>', $lang_Commn_RequiredFieldMark); ?>.</div>
    
<script type="text/javascript">
    <!--
    	if (document.getElementById && document.createElement) {
 			roundBorder('outerbox');
		}
    -->
</script>
</body>
</html>
